package com.example.springboot_mvc_demo.controller;

import com.example.springboot_mvc_demo.log.BusinessType;
import com.example.springboot_mvc_demo.log.Log;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * http://localhost:8081 /test/start
 * http://localhost:8081 /test/end
*/
@Controller
@RequestMapping("/test")
public class TestController {

    @Log(title = "start",businessType = BusinessType.QUERY,isSaveRequestData = true)
	@ResponseBody
    @RequestMapping(value = "/start",method ={ RequestMethod.DELETE,RequestMethod.GET})
    //get post delete put
    public String startTest(String id) {
        return "success";
    }

    @ResponseBody
    //@RequestMapping("/end")
    //@RequestMapping(value = "/end",method ={RequestMethod.GET})
    @Log(title = "end",businessType = BusinessType.QUERY)
    @GetMapping("/end")
    public Map end() {
        //log.info("{}",clazzRoom);
        int i = 1/0;
        Map<Object, Object> hashMap = new HashMap<>();
        hashMap.put("data","success");
        hashMap.put("code",200);
        return hashMap;
    }
}
